<template>
  <div class="home">
    <swiper />
    <div class="section" v-for="(item,index) in resultsList" :key="index">
      <div class="section-title">{{item.name}}</div>
      <content-list :contentList="item.list"></content-list>
    </div>
  </div>
</template>

<script>
import Swiper from "../components/Swiper";
import contentList from '../components/ContentList';
import {getAllHarvest,getAllIdentify} from '../api/index';
export default {
  name: 'home',
  components: {
    Swiper,
    contentList
  },
  data () {
    return {
      resultsList: [
        {name:"近期上传麦穗情况",list: []},
        // {name:"近期纠错结果页面",list: []}
      ]
    }
  },
  created () {
   this.getDetailsList();
   this.getSinger();
  },
  methods: {
    getDetailsList(){                      //获取前十条歌单
      getAllIdentify().then((res) => {
        this.resultsList[0].list = res.data.slice(0,10);
      }).catch((err) => {
        console.log(err);
      })
    },
    getSinger(){                      //获取前十名歌手
      getAllHarvest().then((res) => {
        this.resultsList[1].list = res.data.slice(0,10);
      }).catch((err) => {
        console.log(err);
      })
    }
  }
}
</script>

<style lang="scss" scoped>
@import '../assets/css/home.scss';
</style>
